using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Sec_Admin_Modules;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BussinessObjects;
using BussinessObjects.BO_Actions.Sec_Admin_Modules;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_Sec_Admin_Modules
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BOSec_Admin_Modules_Select_All action = new BOSec_Admin_Modules_Select_All();
                usp_Sec_Admin_Modules_Select_All entity = new usp_Sec_Admin_Modules_Select_All();
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectParent(int status, int parentid)
        {
            try
            {
                BOSec_Admin_Modules_Select_Parent action = new BOSec_Admin_Modules_Select_Parent();
                usp_Sec_Admin_Modules_Select_Parent entity = new usp_Sec_Admin_Modules_Select_Parent();
                entity.STATUS = status;
                entity.PARENT = parentid;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectPermission(int parentid)
        {
            try
            {
                BOSec_Admin_Modules_Select_Permission action = new BOSec_Admin_Modules_Select_Permission();
                usp_Sec_Admin_Modules_Select_Permission entity = new usp_Sec_Admin_Modules_Select_Permission();
                entity.PARENT = parentid;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable BeforeInsert(int parent_id)
        {
            try
            {
                BOSec_Admin_Modules_Before_Insert action = new BOSec_Admin_Modules_Before_Insert();
                usp_Sec_Admin_Modules_Before_Insert entity = new usp_Sec_Admin_Modules_Before_Insert();
                entity.PARENT_MODULE_ID = parent_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BOSec_Admin_Modules_Select_Top action = new BOSec_Admin_Modules_Select_Top();
                usp_Sec_Admin_Modules_Select_Top entity = new usp_Sec_Admin_Modules_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int admin_module_id)
        {
            try
            {
                BOSec_Admin_Modules_Search action = new BOSec_Admin_Modules_Search();
                usp_Sec_Admin_Modules_Search entity = new usp_Sec_Admin_Modules_Search();
                entity.ADMIN_MODULE_ID = admin_module_id;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SearchByName(string module_name)
        {
            try
            {
                BOAdmin_Modules_Search_By_Name action = new BOAdmin_Modules_Search_By_Name();
                usp_Admin_Modules_Search_By_Name entity = new usp_Admin_Modules_Search_By_Name();
                entity.MODULE_NAME = module_name;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                BOSec_Admin_Modules_Select_WithPaged action = new BOSec_Admin_Modules_Select_WithPaged();
                usp_Sec_Admin_Modules_Select_WithPaged entity = new usp_Sec_Admin_Modules_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int PARENT_MODULE_ID, string MODULE_NAME, string DESCRIPTION, string thumb_icon, bool IS_DISPLAY, int SORT_DISPLAY, int TOTAL_VIEW, DateTime LAST_VIEW, DateTime CREATED_DATE, string CREATED_BY, DateTime MODIFY_DATE, string MODIFY_BY, bool STATUS)
        {
            try
            {
                BOSec_Admin_Modules_Insert action = new BOSec_Admin_Modules_Insert();
                usp_Sec_Admin_Modules_Insert entity = new usp_Sec_Admin_Modules_Insert();
                entity.PARENT_MODULE_ID = PARENT_MODULE_ID;
                entity.MODULE_NAME = MODULE_NAME;
                entity.DESCRIPTION = DESCRIPTION;
                entity.THUMB_ICON = thumb_icon;
                entity.SORT_DISPLAY = SORT_DISPLAY;
                entity.TOTAL_VIEW = TOTAL_VIEW;
                entity.LAST_VIEW = LAST_VIEW;
                entity.CREATED_DATE = CREATED_DATE;
                entity.CREATED_BY = CREATED_BY;
                entity.MODIFY_DATE = MODIFY_DATE;
                entity.MODIFY_BY = MODIFY_BY;
                entity.STATUS = STATUS;
                entity.IS_DISPLAY = IS_DISPLAY;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(int ADMIN_MODULE_ID, int PARENT_MODULE_ID, string MODULE_NAME, string DESCRIPTION, string thumb_icon, bool IS_DISPLAY, int SORT_DISPLAY, int TOTAL_VIEW, DateTime LAST_VIEW, DateTime CREATED_DATE, string CREATED_BY, DateTime MODIFY_DATE, string MODIFY_BY, bool STATUS)
        {
            try
            {
                BOSec_Admin_Modules_Update action = new BOSec_Admin_Modules_Update();
                usp_Sec_Admin_Modules_Update entity = new usp_Sec_Admin_Modules_Update();
                entity.ADMIN_MODULE_ID = ADMIN_MODULE_ID;
                entity.PARENT_MODULE_ID = PARENT_MODULE_ID;
                entity.MODULE_NAME = MODULE_NAME;
                entity.DESCRIPTION = DESCRIPTION;
                entity.THUMB_ICON = thumb_icon;
                entity.SORT_DISPLAY = SORT_DISPLAY;
                entity.TOTAL_VIEW = TOTAL_VIEW;
                entity.LAST_VIEW = LAST_VIEW;
                entity.CREATED_DATE = CREATED_DATE;
                entity.CREATED_BY = CREATED_BY;
                entity.MODIFY_DATE = MODIFY_DATE;
                entity.MODIFY_BY = MODIFY_BY;
                entity.STATUS = STATUS;
                entity.IS_DISPLAY = IS_DISPLAY;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string UpdateOrder(int ADMIN_MODULE_ID, int SORT_DISPLAY, DateTime MODIFY_DATE, string MODIFY_BY)
        {
            try
            {
                BOSec_Admin_Modules_Update_Order action = new BOSec_Admin_Modules_Update_Order();
                usp_Sec_Admin_Modules_Update_Order entity = new usp_Sec_Admin_Modules_Update_Order();
                entity.ADMIN_MODULE_ID = ADMIN_MODULE_ID;
                entity.SORT_DISPLAY = SORT_DISPLAY;
                entity.MODIFY_DATE = MODIFY_DATE;
                entity.MODIFY_BY = MODIFY_BY;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int admin_module_id)
        {
            try
            {
                BOSec_Admin_Modules_Delete action = new BOSec_Admin_Modules_Delete();
                usp_Sec_Admin_Modules_Delete entity = new usp_Sec_Admin_Modules_Delete();
                entity.ADMIN_MODULE_ID = admin_module_id;

                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Up(int admin_module_id)
        {
            try
            {
                BOSec_Admin_Modules_Up action = new BOSec_Admin_Modules_Up();
                usp_Sec_Admin_Modules_Up entity = new usp_Sec_Admin_Modules_Up();
                entity.ADMIN_MODULE_ID = admin_module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Down(int admin_module_id)
        {
            try
            {
                BOSec_Admin_Modules_Down action = new BOSec_Admin_Modules_Down();
                usp_Sec_Admin_Modules_Down entity = new usp_Sec_Admin_Modules_Down();
                entity.ADMIN_MODULE_ID = admin_module_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Order(string strAdminModuleID, string delimiter, int start)
        {
            try
            {
                BOSec_Admin_Modules_Order action = new BOSec_Admin_Modules_Order();
                usp_Sec_Admin_Modules_Order entity = new usp_Sec_Admin_Modules_Order();
                entity.String = strAdminModuleID;
                entity.Delimiter = delimiter;
                entity.START = start;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int admin_module_id)
        {
            try
            {
                BOSec_Admin_Modules_Restore action = new BOSec_Admin_Modules_Restore();
                usp_Sec_Admin_Modules_Restore entity = new usp_Sec_Admin_Modules_Restore();
                entity.ADMIN_MODULE_ID = admin_module_id;

                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

